﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.YG
{
    class Class1
    {
        /// <summary>
        /// 阳光_大富翁两全保险_主_A款_分红型
        /// </summary>
        /// <param name="ppa"></param>
        /// <param name="da"></param>
        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            string a = ppa.PolicyActing.Policy.SelectedColRateFactors["领取年限"];

            int receiveAge = 0;

            if (a == "50岁")
                receiveAge = 50;
            else if (a == "55岁")
                receiveAge = 55;
            else if (a == "60岁")
                receiveAge = 60;
            else if (a == "65岁")
                receiveAge = 65;

            if (ppa.Age < receiveAge)
            {
                da.Value = ppa.PolicyActing.Policy.Fee * 0.05;
            }
            else if (ppa.Age >= receiveAge && ppa.Age <= 85)
            {
                ppa.Amount =ppa.PolicyActing.Policy.Amount+ ppa.PolicyActing.Policy.Amount * (ppa.Age - receiveAge) * 0.03;
                da.Value = ppa.Amount;
            }
        }
        /// <summary>
        /// 祝寿保险金给付
        /// </summary>
        /// <param name="ppa"></param>
        /// <param name="da"></param>
        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Age==60)
            {
                da.Value = ppa.Amount * 2;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="ppa"></param>
        /// <param name="da"></param>
        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Age==80)
            {
                da.Value = ppa.TotalFee;
            }
        }
        /// <summary>
        /// 身故给付
        /// </summary>
        /// <param name="ppa"></param>
        /// <param name="da"></param>
        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                da.Value = ppa.TotalFee;
            }
        }

        public void Calc200(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                IPolicy ep = ppa.SchemePeriodActing.SchemeActing.Scheme.GetPolicy("生命_福康提前给付重大疾病保险_附");

                double epFee = ep == null ? 0f : ep.Fee;

                da.Value = (ppa.PolicyActing.Policy.Fee + epFee) * (ppa.Period + 1);

                ppa.IsCurrentFinish = true;
            }

        }
    }
}
